#!/bin/bash
# Generate DejaVu TDD file from Catalog.osm file

cwd=$PWD

# Extract CATOsmStyle from the osm file
./GenCatalogTDDFromOSM.sh CATOsmBookContent.osm CATOsmStyle | tee src/catalog.tdd

# Run fmpp in catalog directory with catalog.tdd file. Output - transformed files to ./out directory
./catalog.bat

# Inject CatalogModified.py to ../test/testCatalog.py directory. which will be processed and become the input tdd for 
# further code generation

#python /bin/cog.py -D FileToInject="C:\Raman\code\CodeGen\CodePatterns\\tdd\catalog\out\CatalogModified.py" -d -o ../test/test.py ../test/testCatalog.py
#-D FileToInject  : Global string variable accessible inside cog code
python /bin/cog.py -D FileToInject="$cwd\out\CatalogModified.py" -d -o ../test/test.py ../test/testCatalog.py

#python out/CatalogModified.py

# Go to test directory
 cd ../test
 
 # Run the test directory version of DejaVu.sh to generate the tdd file for testcase code generation.
 ./DejaVu.sh

# Go one level up again 
cd ..

# Now run fmpp with test\test.tdd file and generate testcase code.
./Test.bat

cd $cwd

